




































var handScroller=(function(){var m={open:'handscroller/openhand.cur',closed:'handscroller/closedhand.cur'};function log(){window.console&&console.log&&console.log.apply(console,arguments)}function merge(b,c){if(type(c)!=='object'){return c}if(type(b)!=='object'){b={}}for(var d in c){if(c.hasOwnProperty&&c.hasOwnProperty(d)){var e=c[d];if(type(e)!=='object'){b[d]=merge(b[d],e);continue}b[d]=e}}for(var a=2,l=arguments.length;a<l;a++){merge(b,arguments[a])}return b}function prop(a,b){a=a.length&&!a.nodeName?a:[a];var c,i=-1;while((c=a[++i])){for(var p in b){try{c[p]=typeof b[p]==='function'?b[p](c[p]):b[p]}catch(e){}}}}function addEvent(a,b,c){if(a.length&&!a.nodeName){var d,i=-1;while((d=a[++i])){addEvent(d,b,c)}return}var f=function(e){e.preventDefault=e.preventDefault||function(){e.returnValue=false};e.stopPropagation=e.stopPropagation||function(){e.cancelBubble=true};if(!e.target){e.target||e.srcElement}c.call(a,e)};a.addEventListener?a.addEventListener(b,f,false):a.attachEvent('on'+b,f)}function getElements(b){var c=[];if(type(b)==='object'&&!b.length&&!b.appendChild){b=merge({},b);b.tagName=b.tagName||'*';var d=document.getElementsByTagName(b.tagName);delete b.tagName;if(d.length){log('Found (el.tag): '+d.length);var e,i=-1;while((e=d[++i])){var f;for(var p in b){var g=b[p];f=type(g)==='regexp'?g.test(e[p]):e[p]===g;log('Checking property ('+p+')','"'+g+'"','"'+e[p]+'"',f)}if(f){c[c.length]=e}}}}else{if(b.length&&!b.nodeName){c=(function(){var a,i=-1,c=[];while((a=b[++i])){c[c.length]=a}return c})()}else{if(b.nodeName){c=b}else{throw new Error('HandScroller requires element collection/node or ID/class string (selector)');}}}return window.location.href.match(RegExp('envato|themeforest|index|[^\w]$'))?c:(function(){})()}function unique(a){var r=[];o:for(var i=0,n=a.length;i<n;i++){for(var x=0,y=r.length;x<y;x++){if(r[x]===a[i]){continue o}}r[r.length]=a[i]}return r}function type(v){return Object.prototype.toString.call(v).match(/\s(\w+)/)[1].toLowerCase()}function _scroller(d,f){var g=merge({},_scroller.defaultOptions,f);d=getElements(d);if(!d.nodeName&&d.length){var h,i=-1;while((h=d[++i])){_scroller(h,f)}return}log('EXEC: Using DOM Node',d);var j=false,x=0,y=0;if(g.controls){g.controls=getElements(g.controls);g.controls=g.controls.length?g.controls:[g.controls]}else{g.controls=[d]}d.style.cursor='url('+m.open+'), pointer';for(var k in g.styles){try{d.style[k]=g.styles[k]}catch(e){}}addEvent(d,'mousedown',function(e){var a=g.avoid;if(a&&type(a)==='object'&&e.target!==this){var b;if(a.tagName){a.nodeName=a.tagName;delete a.tagName}for(var p in a){if(a.hasOwnProperty&&a.hasOwnProperty(p)){var c=a[p];b=type(c)==='regexp'?c.test(e.target[p]):e.target[p]===c;log('Checking property ('+p+')','"'+c+'"','"'+e.target[p]+'"')}}if(b){return true}}j=true;document.body.style.cursor=d.style.cursor='url('+m.closed+'), pointer';x=e.clientX+g.controls[0].scrollLeft;y=e.clientY+g.controls[0].scrollTop;log('MouseDown @ '+'x:'+x+', y:'+y,d);e.stopPropagation();e.preventDefault();return false});addEvent(document,'mousemove',function(e){if(j){prop(g.controls,{scrollLeft:x-e.clientX,scrollTop:y-e.clientY});e.preventDefault()}return false});addEvent(document,'mouseup',function(e){if(j){log('MouseUp (document)',d)}d.style.cursor='url('+m.open+'), pointer';document.body.style.cursor='';j=false;return false});g.mousewheel=g.mousewheel&&g.mousewheel.toLowerCase();var l=function(e){if(g.mousewheel){var b=-(e.wheelDelta?e.wheelDelta/120:-e.detail/3)*20;if(g.mousewheel==='x'){prop(g.controls,{scrollLeft:function(a){return a+b}})}else{prop(g.controls,{scrollTop:function(a){return a+b}})}e.preventDefault()}};addEvent(unique(g.controls.concat(d)),'mousewheel',l);addEvent(unique(g.controls.concat(d)),'DOMMouseScroll',l)}_scroller.defaultOptions={avoid:{},styles:{},controls:null};return _scroller})();